<?php

namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;
use App\Models\Device;
use Encore\Admin\Controllers\Dashboard;
use Encore\Admin\Layout\Column;
use Encore\Admin\Layout\Content;
use Encore\Admin\Layout\Row;

class HomeController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->title(__('Dashboard'))
            ->description('Description...')
//            ->row(Dashboard::title())
            ->row(function (Row $row) {

//                $row->column(4, function (Column $column) {
//                    $column->append(Dashboard::environment());
//                });
//
//                $row->column(4, function (Column $column) {
//                    $column->append(Dashboard::extensions());
//                });
//
//                $row->column(4, function (Column $column) {
//                    $column->append(Dashboard::dependencies());
//                });
            });
    }
    public function deviceMap(Content $content){
        // 选填
        $content->title('设备地图');

        // 选填
        $content->description('标注设备位置');

        // 添加面包屑导航 since v1.5.7
        $content->breadcrumb(
            ['text' => '首页', 'url' => '/admin'],
            ['text' => '设备', 'url' => '/admin/devices'],
            ['text' => '设备地图']
        );


        // `row`是`body`方法的别名
        $content->view('custom.device_map',['models'=>Device::all()]);

        // 直接渲染视图输出，Since v1.6.12
//        $content->view('admin::dashboard.extensions', ['extensions' => 'foo']);

        return $content;
    }
}
